$(function () {;
    (function () {
        var h = 67;
        var mh = 67 * 8;
        $('.home-fbox-group').hover(function () {
            $(this).addClass('active').siblings().removeClass('active');
            $(this).siblings().find('.home-fbox-detail').hide();
            var idx = $(this).index();
            var dh = $(this).find('.home-fbox-detail').height();
            if (dh + h * idx <= mh) {
                $(this).find('.home-fbox-detail').css({
                    'top': '0px'
                }).show();
            } else {
                $(this).find('.home-fbox-detail').css({
                    'top': (-(dh + h * idx - mh + 21)) + 'px'
                }).show();
            }
        }, function () {
            $(this).removeClass('active');
            $(this).find('.home-fbox-detail').hide();
        });
    })();


    new Swiper('.cyzx-pic-left', {
        pagination: '.cyzx-pic-left .pagination',
        loop: true,
        autoplay: 3000,
        paginationClickable: true
    });

    $(".cnxh").slide({
        autoPlay: true,
        effect: 'fold'
    });

    $('.lyb-rlist a').click(function () {
        $('#content').val($('#content').val() + $(this).html())
    })

    $(".aside-slide").slide({
        autoPlay: true,
        effect: 'leftLoop'
    });

    new Swiper('.aside-swiper', {
        pagination: '.aside-swiper .pagination',
        loop: true,
        autoplay: 3000,
        paginationClickable: true
    });

    (function () {
        var swiper = new Swiper('.aside-gay .swiper-container', {
            pagination: '.aside-gay .pagination',
            loop: true,
            autoplay: 3000,
            paginationClickable: true
        });
        $('.aside-gay .swiper-button-prev').on('click', function () {
            swiper.swipePrev()
        });
        $('.aside-gay .swiper-button-next').on('click', function () {
            swiper.swipeNext()
        });
    })();

    (function () {
        var $logo = $('.float-form-logo');
        var $box = $('.float-form-box');
        var $btn = $('.float-form-box-close'); 
        $logo.click(function () {
            if ($box.width() == 0) {
                $box.animate({width: '1200px'});
            } else {
                $box.animate({width: '0px'});
            }
        });
        $btn.click(function(){
            $box.animate({width: '0px'});
        });

    })();

    (function () {
        var $anchors = $('.cyzx-anchors a');
        $anchors.click(function () {
            $(this).addClass('active').siblings().removeClass('active');
        })
    })();

});